import request from "@/utils/request"
import type {
  swiperResponseData,
  navItemResponseData,
  advertisementResponseData,
  recommendResponseData,
  categoryListResponseData,
  productResponseData,
  moreResponseData

} from '@/types'
enum API{
  //轮播图数据
  swiperData = "/index/findBanner",
  //导航栏数据
  navListData = '/index/findCategory1',
  //广告栏
  advertisement ='/index/advertisement',
  //猜你喜欢
  findListGoods='/index/findListGoods',
  //推荐
  findRecommendGoods='/index/findRecommendGoods',

  //商品详情接口
  goodsDetail = '/goods/',
  //分裂列表数据
  categoryList = 'index/findCategoryTree',
  //查看更多
  more = '/goods/list/'
}
//获取首页轮播图数据
export const reqSwiperData = ()=>request.get<any,swiperResponseData>(API.swiperData)

// 导航栏请求数据
export const reqNavListData = ()=>request.get<any,navItemResponseData>(API.navListData)

//广告栏数据
export const reqAdvListData = ()=>request.get<any,advertisementResponseData>(API.advertisement)

//热门推荐
export const reqHotRecommend = ()=>request.get<any,recommendResponseData>(API.findRecommendGoods)
//猜你喜欢
export const reqLike = ()=>request.get<any,recommendResponseData>(API.findListGoods)

//分类列表
export const reqCategoryList = ()=>request.get<any,categoryListResponseData>(API.categoryList)

//获取商品详情
export const reqGoodsDetail = (id:number) =>request<any,productResponseData>(API.goodsDetail+id)

//查看更多
export const reqMoreGoods = (page:number,limit:number)=>request<any,moreResponseData>(API.more+`${page}/${limit}`)

